
function edit(id){
	var url = 'edit_warehouse.html?'+id;
	var config = 'dialogWidth:240px;dialogHeight:170px;scroll:no;status:no;';
	window.showModalDialog(url,'',config);
	//window.open(url,'',config);
	selectWarehouse();
};
function selectWarehouse(){
	
	var storehouse_name = escape(escape(document.getElementById('storehouse_name').value));
	var employee_id = escape(escape(document.getElementById('employee_id').value));
	employee_id = employee_id==''?-1:employee_id;

	var url = '/storage/admin/pages/warehouse.do?method=selectWarehouse&d=' + new Date();
	url = url + '&storehouse_name='+storehouse_name;
	url = url + '&employee_id='+employee_id;
	
	$.getJSON(url, {}, function(data){
		$('#warehouseList').html('');

		var _max = get_max_line(470,25);
		
		for(var i=0;i<data.length;i++){
			var style_border = 0-(0-i-1)==data.length&&data.length>=_max?'style="border-bottom:0;"':'';
			var warehouseList = '';
			warehouseList = warehouseList + '<tr style="height:15px;" onmouseover="cbgcolor(this,0)" onmouseout="cbgcolor(this,1)">';
			warehouseList = warehouseList + '  <td class="list" '+style_border+' width="100" >'+data[i][1]+'</td>';
			warehouseList = warehouseList + '  <td class="list" '+style_border+' width="100" >'+data[i][2]+'</td>';
			warehouseList = warehouseList + '  <td class="list" '+style_border+' width="130" >'+data[i][3]+'</td>';
			warehouseList = warehouseList + '  <td class="list" '+style_border+' width="" >'+data[i][4]+'</td>';
			warehouseList = warehouseList + '  <td class="list" '+style_border+' width="150" >'+data[i][5]+'</td>';
			warehouseList = warehouseList + '  <td class="list" '+style_border+' width="50" ><a href="javascript:void(0)" onclick="edit('+data[i][0]+')">编辑</a></td>';
			warehouseList = warehouseList + '</tr>';
			$('#warehouseList').append(warehouseList);
		}
		if(data.length<_max){
			add_foot();
		}
	});
};
function add_foot(){
	var foot = '';
    foot = foot + '<tr>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="100" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="100" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="130" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="150" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="50" >&nbsp;</td>';
	foot = foot + '</tr>';
	$('#warehouseList').append(foot);
};